function request(url, params = {}, type = "get") {
    return new Promise(function (resolve, reject) {
        $.ajax({
            type: type,
            url: url,
            data: {
                ...params,
            },
            async: true,
            dataType: "json",
            success: function (result) {
                resolve(result);
            },
        })
    })
}



const isExistUser = params => request("../php/isExistUser.php", params, "post");

const ajaxLoad = params => request("../php/searchOrder_copy.php", params, "get");

const regist = params => request("../php/register.php", params, "post");

const login = params => request("../php/login.php", params, "post");

const searchAllGoods = params => request("../php/searchAllGoods.php", params);

const searchGoodsById = params => request("../php/searchGoodsById.php", params);

const addShoppingCar = params => request("../php/addShoppingCar.php", params, "post");

// 购物车
const searchShoppingByUser = params => request("../php/searchShoppingByUser.php", params, "post");
const deleteShoppingCarById = params => request("../php/deleteShoppingCarById.php", params);

const updateGoods = params => request("../php/updateGoods.php", params, "post");